<!-- src/components/Upload/SkuImageUpload.vue -->
<template>
  <BaseUpload
    v-model="modelValue"
    :max-count="1"
    :max-size="0.5"
    accept="image/jpeg,image/png"
    tip=""
    endpoint="/upload/sku"
    class="sku-upload"
  >
    <template #default>
      <el-icon><Camera /></el-icon>
    </template>
  </BaseUpload>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import BaseUpload from './BaseUpload.vue';
import { Camera } from '@element-plus/icons-vue';

const props = defineProps({
  modelValue: String
});

const emit = defineEmits(['update:modelValue']);

const modelValue = computed({
  get: () => props.modelValue ? [props.modelValue] : [],
  set: (value) => emit('update:modelValue', value[0] || '')
});
</script>

<style scoped>
.sku-upload {
  :deep(.el-upload) {
    width: 80px;
    height: 80px;
    line-height: 80px;
    text-align: center;
    
    .el-icon {
      font-size: 20px;
    }
  }
}
</style>